package com.web.tree;

public class BinaryTree {
	
	private String value;
	
	private BinaryTree leftNode;
	
	private BinaryTree rightNode;
	
	public BinaryTree() {
	}
	public BinaryTree(String value) {
		this.value = value;
	}

	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	public BinaryTree getLeftNode() {
		return leftNode;
	}
	public void setLeftNode(BinaryTree leftNode) {
		this.leftNode = leftNode;
	}
	
	public BinaryTree getRightNode() {
		return rightNode;
	}
	public void setRightNode(BinaryTree rightNode) {
		this.rightNode = rightNode;
	}
	
	/**
	 * 是否有左节点
	 * @return
	 */
	public boolean hasLeftNode() {
		if (this.leftNode == null || this.leftNode.getValue() == null) {
			return false;
		}
		return true;
	}
	
	/**
	 * 是否有又节点
	 * @return
	 */
	public boolean hasRightNode() {
		if (this.rightNode == null || this.rightNode.getValue() == null) {
			return false;
		}
		return true;
	}
}
